package com.ruoyi.mall.app.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.mall.app.service.DtsCateDetailService;
import com.ruoyi.mall.common.domain.DtsCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/type/category")
public class DtsCategoryController extends BaseController {
    @Autowired
    private DtsCateDetailService dtsCateDetailService;

    @GetMapping("/categoryList")
    public AjaxResult categoryList()
    {
        List<DtsCategory> list = dtsCateDetailService.getCateDetail();
        if (list != null){
            return success(list);
        }else {
            return error();
        }
    }

    @GetMapping("/categoryList2")
    public AjaxResult categoryList2(Long id)
    {
        List<DtsCategory> list = dtsCateDetailService.getCateDetail2(id);
        if (list != null){
            return success(list);
        }else {
            return error();
        }
    }
}
